package com.becca.cake.model.sms;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import com.becca.cake.core.exception.ServiceException;

/**
 * 短信信息表
 * @copyright  尊星(上海)信息科技有限公司
 * @author hejinguo
 * @date 2016年9月2日 上午9:50:22
 */
public class SmsUserModel implements Serializable {

    /**  */
    private static final long serialVersionUID = 7763185363559889012L;

    private Integer           id;

    private String            phoneNumber;

    private Integer           smsIontentId;

    private Byte              gateWay;

    private Byte              smsStatus;

    private Byte              smsType;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date              sendDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date              createdDate;

    private String            createdName;

    private String            content;

    /**
     * 发送短信
     * @param smsUserModel
     */
    public static void validateAddSendSmsParam(SmsUserModel smsUserModel) {
        if ((smsUserModel.getGateWay() == 0 || smsUserModel.getGateWay() == 1)
            && StringUtils.isEmpty(smsUserModel.getPhoneNumber())) {
            throw new ServiceException("手机号不能为空");
        }
        if (StringUtils.isEmpty(smsUserModel.getContent())) {
            throw new ServiceException("短信内容不能为空");
        }
    }

    public Integer getId() {
        return id;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public Integer getSmsIontentId() {
        return smsIontentId;
    }

    public Byte getGateWay() {
        return gateWay;
    }

    public Byte getSmsStatus() {
        return smsStatus;
    }

    public Date getSendDate() {
        return sendDate;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public String getCreatedName() {
        return createdName;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public void setSmsIontentId(Integer smsIontentId) {
        this.smsIontentId = smsIontentId;
    }

    public void setGateWay(Byte gateWay) {
        this.gateWay = gateWay;
    }

    public void setSmsStatus(Byte smsStatus) {
        this.smsStatus = smsStatus;
    }

    public void setSendDate(Date sendDate) {
        this.sendDate = sendDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public void setCreatedName(String createdName) {
        this.createdName = createdName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Byte getSmsType() {
        return smsType;
    }

    public void setSmsType(Byte smsType) {
        this.smsType = smsType;
    }

}
